home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kpropertiesdialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  24.9 KB  |  919 lines

  1. /* This file is part of the KDE project
  2.    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  3.    Copyright (c) 1999, 2000 Preston Brown <pbrown@kde.org>
  4.    Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
  5.    Copyright (c) 2000 David Faure <faure@kde.org>
  6.  
  7.    This library is free software; you can redistribute it and/or
  8.    modify it under the terms of the GNU Library General Public
  9.    License as published by the Free Software Foundation; either
  10.    version 2 of the License, or (at your option) any later version.
  11.  
  12.    This library is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.    Library General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU Library General Public License
  18.    along with this library; see the file COPYING.LIB.  If not, write to
  19.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.    Boston, MA 02110-1301, USA.
  21. */
  22.  
  23. /*
  24.  * This file holds the definitions for all classes used to
  25.  * display a properties dialog.
  26.  */
  27.  
  28. #ifndef __propsdlg_h
  29. #define __propsdlg_h
  30.  
  31. #include <qstring.h>
  32. #include <qptrlist.h>
  33.  
  34. #include <kdemacros.h>
  35. #include <kurl.h>
  36. #include <kfileitem.h>
  37. #include <kdialogbase.h>
  38.  
  39. class QLineEdit;
  40. class QCheckBox;
  41. class QPushButton;
  42. class KLineEdit;
  43. class KURLRequester;
  44. class QButton;
  45. class KIconButton;
  46. class KPropsDlgPlugin;
  47. class QComboBox;
  48.  
  49. #define KPropsPage KPropsDlgPlugin
  50.  
  51. namespace KIO { class Job; }
  52.  
  53. /**
  54.  * The main properties dialog class.
  55.  * A Properties Dialog is a dialog which displays various information
  56.  * about a particular file or URL, or several files or URLs.
  57.  * This main class holds various related classes, which are instantiated in
  58.  * the form of tab entries in the tabbed dialog that this class provides.
  59.  * The various tabs themselves will let the user view, and sometimes change,
  60.  * information about the file or URL.
  61.  *
  62.  * \image html kpropertiesdialog.png "Typical KProperties Dialog"
  63.  *
  64.  * This class must be created with (void)new KPropertiesDialog(...)
  65.  * It will take care of deleting itself.
  66.  * 
  67.  * If you are looking for more flexibility, see KFileMetaInfo and
  68.  * KFileMetaInfoWidget.
  69.  */
  70. class KIO_EXPORT KPropertiesDialog : public KDialogBase
  71. {
  72.   Q_OBJECT
  73.  
  74. public:
  75.  
  76.   /**
  77.    * Determine whether there are any property pages available for the
  78.    * given file items.
  79.    * @param _items the list of items to check.
  80.    * @return true if there are any property pages, otherwise false.
  81.    */
  82.   static bool canDisplay( KFileItemList _items );
  83.  
  84.   /**
  85.    * Brings up a Properties dialog, as shown above. 
  86.    * This is the normal constructor for
  87.    * file-manager type applications, where you have a KFileItem instance 
  88.    * to work with.  Normally you will use this
  89.    * method rather than the one below.
  90.    *
  91.    * @param item file item whose properties should be displayed.
  92.    * @param parent is the parent of the dialog widget.
  93.    * @param name is the internal name.
  94.    * @param modal tells the dialog whether it should be modal.
  95.    * @param autoShow tells the dialog whether it should show itself automatically.
  96.    */
  97.   KPropertiesDialog( KFileItem * item,
  98.                      QWidget* parent = 0L, const char* name = 0L,
  99.                      bool modal = false, bool autoShow = true);
  100.  
  101.   /**
  102.    * \overload
  103.    *
  104.    * You use this constructor for cases where you have a number of items,
  105.    * rather than a single item. Be careful which methods you use
  106.    * when passing a list of files or URLs, since some of them will only
  107.    * work on the first item in a list.
  108.    *
  109.    * @param _items list of file items whose properties should be displayed.
  110.    * @param parent is the parent of the dialog widget.
  111.    * @param name is the internal name.
  112.    * @param modal tells the dialog whether it should be modal.
  113.    * @param autoShow tells the dialog whether it should show itself automatically.
  114.    */
  115.   KPropertiesDialog( KFileItemList _items,
  116.                      QWidget *parent = 0L, const char* name = 0L,
  117.                      bool modal = false, bool autoShow = true);
  118.  
  119. #ifndef KDE_NO_COMPAT
  120.   /**
  121.    * @deprecated  You should use the following constructor instead of this one.
  122.    * The only change that is required is to delete the _mode argument.
  123.    *
  124.    * @param _url the URL whose properties should be displayed
  125.    * @param _mode unused.
  126.    * @param parent is the parent of the dialog widget.
  127.    * @param name is the internal name.
  128.    * @param modal tells the dialog whether it should be modal.
  129.    * @param autoShow tells the dialog whether it should show itself automatically.  */
  130.   KPropertiesDialog( const KURL& _url, mode_t _mode,
  131.                      QWidget* parent = 0L, const char* name = 0L,
  132.                      bool modal = false, bool autoShow = true) KDE_DEPRECATED;
  133. #endif
  134.  
  135.   /**
  136.    * Brings up a Properties dialog. Convenience constructor for
  137.    * non-file-manager applications, where you have a KURL rather than a
  138.    * KFileItem or KFileItemList.
  139.    *
  140.    * @param _url the URL whose properties should be displayed
  141.    * @param parent is the parent of the dialog widget.
  142.    * @param name is the internal name.
  143.    * @param modal tells the dialog whether it should be modal.
  144.    * IMPORTANT: This constructor, together with modal=true, leads to a grave
  145.    * display bug (due to KIO::stat() being run before the dialog has all the
  146.    * necessary information). Do not use this combination for now.
  147.    * For local files with a known mimetype, simply create a KFileItem and pass
  148.    * it to the other constructor.
  149.    *
  150.    * @param autoShow tells the dialog whethr it should show itself automatically.
  151.    */
  152.   KPropertiesDialog( const KURL& _url,
  153.                      QWidget* parent = 0L, const char* name = 0L,
  154.                      bool modal = false, bool autoShow = true);
  155.  
  156.   /**
  157.    * Creates a properties dialog for a new .desktop file (whose name
  158.    * is not known yet), based on a template. Special constructor for
  159.    * "File / New" in file-manager type applications.
  160.    *
  161.    * @param _tempUrl template used for reading only
  162.    * @param _currentDir directory where the file will be written to
  163.    * @param _defaultName something to put in the name field,
  164.    * like mimetype.desktop
  165.    * @param parent is the parent of the dialog widget.
  166.    * @param name is the internal name.
  167.    * @param modal tells the dialog whether it should be modal.
  168.    * @param autoShow tells the dialog whethr it should show itself automatically.
  169.    */
  170.   KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir,
  171.                      const QString& _defaultName,
  172.                      QWidget* parent = 0L, const char* name = 0L,
  173.                      bool modal = false, bool autoShow = true);
  174.  
  175.   /**
  176.    * Creates an empty properties dialog (for applications that want use
  177.    * a standard dialog, but for things not doable via the plugin-mechanism).
  178.    *
  179.    * @param title is the string display as the "filename" in the caption of the dialog.
  180.    * @param parent is the parent of the dialog widget.
  181.    * @param name is the internal name.
  182.    * @param modal tells the dialog whether it should be modal.
  183.    */
  184.   KPropertiesDialog (const QString& title,
  185.                      QWidget* parent = 0L, const char* name = 0L, bool modal = false);
  186.  
  187.   /**
  188.    * Cleans up the properties dialog and frees any associated resources,
  189.    * including the dialog itself. Note that when a properties dialog is
  190.    * closed it cleans up and deletes itself.
  191.    */
  192.   virtual ~KPropertiesDialog();
  193.  
  194.   /**
  195.    * Immediately displays a Properties dialog using constructor with 
  196.    * the same parameters. 
  197.    * On MS Windows, if @p item points to a local file, native (non modal) property 
  198.    * dialog is displayed (@p parent and @p modal are ignored in this case).
  199.    * 
  200.    * @return true on succesfull dialog displaying (can be false on win32).
  201.    * @since 3.4
  202.    */
  203.   static bool showDialog(KFileItem* item, QWidget* parent = 0, 
  204.                          const char* name = 0, bool modal = false);
  205.  
  206.   /**
  207.    * Immediately displays a Properties dialog using constructor with 
  208.    * the same parameters. 
  209.    * On MS Windows, if @p _url points to a local file, native (non modal) property 
  210.    * dialog is displayed (@p parent and @p modal are ignored in this case).
  211.    * 
  212.    * @return true on succesfull dialog displaying (can be false on win32).
  213.    * @since 3.4
  214.    */
  215.   static bool showDialog(const KURL& _url, QWidget* parent = 0, 
  216.                          const char* name = 0, bool modal = false);
  217.  
  218.   /**
  219.    * Immediately displays a Properties dialog using constructor with 
  220.    * the same parameters. 
  221.    * On MS Windows, if @p _items has one element and this element points 
  222.    * to a local file, native (non modal) property dialog is displayed 
  223.    * (@p parent and @p modal are ignored in this case).
  224.    * 
  225.    * @return true on succesfull dialog displaying (can be false on win32).
  226.    * @since 3.4
  227.    */
  228.   static bool showDialog(const KFileItemList& _items, QWidget* parent = 0, 
  229.                          const char* name = 0, bool modal = false);
  230.  
  231.   /**
  232.    * Adds a "3rd party" properties plugin to the dialog.  Useful
  233.    * for extending the properties mechanism.
  234.    *
  235.    * To create a new plugin type, inherit from the base class KPropsDlgPlugin
  236.    * and implement all the methods. If you define a service .desktop file
  237.    * for your plugin, you do not need to call insertPlugin().
  238.    *
  239.    * @param plugin is a pointer to the KPropsDlgPlugin. The Properties
  240.    *        dialog will do destruction for you. The KPropsDlgPlugin \b must
  241.    *        have been created with the KPropertiesDialog as its parent.
  242.    * @see KPropsDlgPlugin
  243.    */
  244.   void insertPlugin (KPropsDlgPlugin *plugin);
  245.  
  246.   /**
  247.    * The URL of the file that has its properties being displayed. 
  248.    * This is only valid if the KPropertiesDialog was created/shown
  249.    * for one file or URL.
  250.    *
  251.    * @return a parsed URL.
  252.    */
  253.   const KURL& kurl() const { return m_singleUrl; }
  254.  
  255.   /**
  256.    * @return the file item for which the dialog is shown
  257.    *
  258.    * Warning: this method returns the first item of the list.
  259.    * This means that you should use this only if you are sure the dialog is used
  260.    * for a single item. Otherwise, you probably want items() instead.
  261.    */
  262.   KFileItem *item() { return m_items.first(); }
  263.  
  264.   /**
  265.    * @return the items for which the dialog is shown
  266.    */
  267.   KFileItemList items() const { return m_items; }
  268.  
  269.   /**
  270.    * @return a pointer to the dialog
  271.    * @deprecated KPropertiesDialog directly inherits from KDialogBase, so use \a this instead
  272.    */
  273.   KDE_DEPRECATED KDialogBase* dialog() { return this; }
  274.   /**
  275.    * @return a pointer to the dialog
  276.    * @deprecated KPropertiesDialog directly inherits from KDialogBase, so use \a this instead
  277.    */
  278.   KDE_DEPRECATED const KDialogBase* dialog() const { return this; }
  279.  
  280.   /**
  281.    * If the dialog is being built from a template, this method
  282.    * returns the current directory. If no template, it returns QString::null.
  283.    * See the template form of the constructor.
  284.    *
  285.    * @return the current directory or QString::null
  286.    */
  287.   const KURL& currentDir() const { return m_currentDir; }
  288.  
  289.   /**
  290.    * If the dialog is being built from a template, this method
  291.    * returns the default name. If no template, it returns QString::null.
  292.    * See the template form of the constructor.
  293.    * @return the default name or QString::null
  294.    */
  295.   const QString& defaultName() const { return m_defaultName; }
  296.  
  297.   /**
  298.    * Updates the item URL (either called by rename or because
  299.    * a global apps/mimelnk desktop file is being saved)
  300.    * Can only be called if the dialog applies to a single file or URL.
  301.    * @param _newUrl the new URL
  302.    */
  303.   void updateUrl( const KURL& _newUrl );
  304.  
  305.   /**
  306.    * Renames the item to the specified name. This can only be called if
  307.    * the dialog applies to a single file or URL.
  308.    * @param _name new filename, encoded.
  309.    * \see FilePropsDlgPlugin::applyChanges
  310.    */
  311.   void rename( const QString& _name );
  312.  
  313.   /**
  314.    * To abort applying changes.
  315.    */
  316.   void abortApplying();
  317.  
  318.   /**
  319.    * Shows the page that was previously set by
  320.    * setFileSharingPage(), or does nothing if no page
  321.    * was set yet.
  322.    * \see setFileSharingPage
  323.    * @since 3.1
  324.    */
  325.   void showFileSharingPage();
  326.   
  327.   /**
  328.    * Sets the file sharing page.
  329.    * This page is shown when calling showFileSharingPage().
  330.    *
  331.    * @param page the page to set
  332.    * \see showFileSharingPage
  333.    * @since 3.3
  334.    */
  335.   void setFileSharingPage(QWidget* page);
  336.  
  337.    /**
  338.     * Call this to make the filename lineedit readonly, to prevent the user
  339.     * from renaming the file.
  340.     * \param ro true if the lineedit should be read only
  341.     * @since 3.2
  342.     */
  343.   void setFileNameReadOnly( bool ro );
  344.  
  345. public slots:
  346.   /**
  347.    * Called when the user presses 'Ok'.
  348.    */
  349.   virtual void slotOk();      // Deletes the PropertiesDialog instance
  350.   /**
  351.    * Called when the user presses 'Cancel'.
  352.    */
  353.   virtual void slotCancel();     // Deletes the PropertiesDialog instance
  354.  
  355. signals:
  356.   /**
  357.    * This signal is emitted when the Properties Dialog is closed (for
  358.    * example, with OK or Cancel buttons)
  359.    */
  360.   void propertiesClosed();
  361.  
  362.   /**
  363.    * This signal is emitted when the properties changes are applied (for
  364.    * example, with the OK button)
  365.    */
  366.   void applied();
  367.  
  368.   /**
  369.    * This signal is emitted when the properties changes are aborted (for
  370.    * example, with the Cancel button)
  371.    */
  372.  
  373.   void canceled();
  374.   /**
  375.    * Emitted before changes to @p oldUrl are saved as @p newUrl.
  376.    * The receiver may change @p newUrl to point to an alternative
  377.    * save location.
  378.    */
  379.   void saveAs(const KURL &oldUrl, KURL &newUrl);
  380.  
  381. private:
  382.  
  383.   /**
  384.    * Common initialization for all constructors
  385.    */
  386.   void init (bool modal = false, bool autoShow = true);
  387.  
  388.   /**
  389.    * Inserts all pages in the dialog.
  390.    */
  391.   void insertPages();
  392.  
  393.   /**
  394.    * The URL of the props dialog (when shown for only one file)
  395.    */
  396.   KURL m_singleUrl;
  397.  
  398.   /**
  399.    * List of items this props dialog is shown for
  400.    */
  401.   KFileItemList m_items;
  402.  
  403.   /**
  404.    * For templates
  405.    */
  406.   QString m_defaultName;
  407.   KURL m_currentDir;
  408.  
  409.   /**
  410.    * List of all plugins inserted ( first one first )
  411.    */
  412.   QPtrList<KPropsDlgPlugin> m_pageList;
  413.  
  414. private slots:
  415.   void slotStatResult( KIO::Job * ); // No longer used
  416. protected:
  417.   virtual void virtual_hook( int id, void* data );
  418. private:
  419.   class KPropertiesDialogPrivate;
  420.   KPropertiesDialogPrivate *d;
  421. };
  422.  
  423. /**
  424.  * A Plugin in the Properties dialog
  425.  * This is an abstract class. You must inherit from this class
  426.  * to build a new kind of tabbed page for the KPropertiesDialog.
  427.  * A plugin in itself is just a library containing code, not a dialog's page.
  428.  * It's up to the plugin to insert pages into the parent dialog.
  429.  *
  430.  * To make a plugin available, define a service that implements the KPropsDlg/Plugin
  431.  * servicetype, as well as the mimetypes for which the plugin should be created.
  432.  * For instance, ServiceTypes=KPropsDlg/Plugin,text/html,application/x-mymimetype.
  433.  *
  434.  * You can also include X-KDE-Protocol=file if you want that plugin
  435.  * to be loaded only for local files, for instance.
  436.  */
  437. class KIO_EXPORT KPropsDlgPlugin : public QObject
  438. {
  439.   Q_OBJECT
  440. public:
  441.   /**
  442.    * Constructor
  443.    * To insert tabs into the properties dialog, use the add methods provided by
  444.    * KDialogBase (the properties dialog is a KDialogBase).
  445.    */
  446.   KPropsDlgPlugin( KPropertiesDialog *_props );
  447.   virtual ~KPropsDlgPlugin();
  448.  
  449.   /**
  450.    * Applies all changes to the file.
  451.    * This function is called when the user presses 'Ok'. The last plugin inserted
  452.    * is called first.
  453.    */
  454.   virtual void applyChanges();
  455.  
  456.   /**
  457.    * Convenience method for most ::supports methods
  458.    * @return true if the file is a local, regular, readable, desktop file
  459.    */
  460.   static bool isDesktopFile( KFileItem * _item );
  461.  
  462.   void setDirty( bool b );
  463.   bool isDirty() const;
  464.  
  465. public slots:
  466.   void setDirty(); // same as setDirty( true )
  467.  
  468. signals:
  469.   /**
  470.    * Emit this signal when the user changed anything in the plugin's tabs.
  471.    * The hosting PropertiesDialog will call applyChanges only if the
  472.    * PropsPlugin has emitted this signal before.
  473.    */
  474.   void changed();
  475.  
  476. protected:
  477.   /**
  478.    * Pointer to the dialog
  479.    */
  480.   KPropertiesDialog *properties;
  481.  
  482.   int fontHeight;
  483. protected:
  484.   virtual void virtual_hook( int id, void* data );
  485. private:
  486.   class KPropsDlgPluginPrivate;
  487.   KPropsDlgPluginPrivate *d;
  488. };
  489.  
  490. /**
  491.  * 'General' plugin
  492.  *  This plugin displays the name of the file, its size and access times.
  493.  * @internal
  494.  */
  495. class KIO_EXPORT KFilePropsPlugin : public KPropsDlgPlugin
  496. {
  497.   Q_OBJECT
  498. public:
  499.   /**
  500.    * Constructor
  501.    */
  502.   KFilePropsPlugin( KPropertiesDialog *_props );
  503.   virtual ~KFilePropsPlugin();
  504.  
  505.   /**
  506.    * Applies all changes made.  This plugin must be always the first
  507.    * plugin in the dialog, since this function may rename the file which
  508.    * may confuse other applyChanges functions.
  509.    */
  510.   virtual void applyChanges();
  511.  
  512.   /**
  513.    * Tests whether the files specified by _items need a 'General' plugin.
  514.    */
  515.   static bool supports( KFileItemList _items );
  516.  
  517.   /**
  518.    * Called after all plugins applied their changes
  519.    */
  520.   void postApplyChanges();
  521.  
  522.   void setFileNameReadOnly( bool ro );
  523.  
  524. protected slots:
  525.   void slotEditFileType();
  526.   void slotCopyFinished( KIO::Job * );
  527.   void slotFileRenamed( KIO::Job *, const KURL &, const KURL & );
  528.   void slotDirSizeUpdate();
  529.   void slotDirSizeFinished( KIO::Job * );
  530.   void slotFoundMountPoint( const QString& mp, unsigned long kBSize,
  531.                 unsigned long kBUsed, unsigned long kBAvail );
  532.   void slotSizeStop();
  533.   void slotSizeDetermine();
  534.  
  535. private slots:
  536.   // workaround for compiler bug
  537.   void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long&
  538.               kBUsed, const unsigned long& kBAvail, const QString& mp );
  539.   void nameFileChanged(const QString &text );
  540.   void slotIconChanged();
  541.  
  542. private:
  543.   void determineRelativePath( const QString & path );
  544.   void applyIconChanges();
  545.  
  546.   QWidget *iconArea;
  547.   QWidget *nameArea;
  548.  
  549.   QLabel *m_sizeLabel;
  550.   QPushButton *m_sizeDetermineButton;
  551.   QPushButton *m_sizeStopButton;
  552.  
  553.   QString m_sRelativePath;
  554.   bool m_bFromTemplate;
  555.  
  556.   /**
  557.    * The initial filename
  558.    */
  559.   QString oldName;
  560.  
  561.   class KFilePropsPluginPrivate;
  562.   KFilePropsPluginPrivate *d;
  563. };
  564.  
  565. /**
  566.  * 'Permissions' plugin
  567.  * In this plugin you can modify permissions and change
  568.  * the owner of a file.
  569.  * @internal
  570.  */
  571. class KIO_EXPORT KFilePermissionsPropsPlugin : public KPropsDlgPlugin
  572. {
  573.   Q_OBJECT
  574. public:
  575.   enum PermissionsMode {
  576.     PermissionsOnlyFiles = 0,
  577.     PermissionsOnlyDirs = 1,
  578.     PermissionsOnlyLinks = 2,
  579.     PermissionsMixed = 3
  580.   };
  581.  
  582.   enum PermissionsTarget {
  583.     PermissionsOwner  = 0,
  584.     PermissionsGroup  = 1,
  585.     PermissionsOthers = 2
  586.   };
  587.  
  588.   /**
  589.    * Constructor
  590.    */
  591.   KFilePermissionsPropsPlugin( KPropertiesDialog *_props );
  592.   virtual ~KFilePermissionsPropsPlugin();
  593.  
  594.   virtual void applyChanges();
  595.  
  596.   /**
  597.    * Tests whether the file specified by _items needs a 'Permissions' plugin.
  598.    */
  599.   static bool supports( KFileItemList _items );
  600.  
  601. private slots:
  602.  
  603.   void slotChmodResult( KIO::Job * );
  604.   void slotShowAdvancedPermissions();
  605.  
  606. private:
  607.   void setComboContent(QComboBox *combo, PermissionsTarget target,
  608.                mode_t permissions, mode_t partial);
  609.   bool isIrregular(mode_t permissions, bool isDir, bool isLink);
  610.   void enableAccessControls(bool enable);
  611.   void updateAccessControls();
  612.   void getPermissionMasks(mode_t &andFilePermissions,
  613.               mode_t &andDirPermissions,
  614.               mode_t &orFilePermissions,
  615.               mode_t &orDirPermissions);
  616.  
  617.   static const mode_t permissionsMasks[3];
  618.   static const mode_t standardPermissions[4];
  619.   static const char *permissionsTexts[4][4];
  620.  
  621.   // unused, for binary compatibility!
  622.   QCheckBox *permBox[3][4];
  623.  
  624.   QComboBox *grpCombo;
  625.  
  626.   KLineEdit *usrEdit, *grpEdit;
  627.  
  628.   /**
  629.    * Old permissions
  630.    */
  631.   mode_t permissions;
  632.   /**
  633.    * Old group
  634.    */
  635.   QString strGroup;
  636.   /**
  637.    * Old owner
  638.    */
  639.   QString strOwner;
  640.  
  641.   // unused, for compatibility
  642.   static mode_t fperm[3][4];
  643.  
  644.   class KFilePermissionsPropsPluginPrivate;
  645.   KFilePermissionsPropsPluginPrivate *d;
  646. };
  647.  
  648.  
  649. /**
  650.  * Used to edit the files containing
  651.  * [Desktop Entry]
  652.  * URL=....
  653.  *
  654.  * Such files are used to represent a program in kicker and konqueror.
  655.  * @internal
  656.  */
  657. class KIO_EXPORT KURLPropsPlugin : public KPropsDlgPlugin
  658. {
  659.   Q_OBJECT
  660. public:
  661.   /**
  662.    * Constructor
  663.    */
  664.   KURLPropsPlugin( KPropertiesDialog *_props );
  665.   virtual ~KURLPropsPlugin();
  666.  
  667.   virtual void applyChanges();
  668.  
  669.   static bool supports( KFileItemList _items );
  670.  
  671. private:
  672.   KURLRequester *URLEdit;
  673.   KIconButton *iconBox;
  674.  
  675.   QString URLStr;
  676.   QString iconStr;
  677.  
  678.   QPixmap pixmap;
  679.   QString pixmapFile;
  680. private:
  681.   class KURLPropsPluginPrivate;
  682.   KURLPropsPluginPrivate *d;
  683. };
  684.  
  685.  
  686. /**
  687.  * Used to edit the files containing
  688.  * [Desktop Entry]
  689.  * Type=MimeType
  690.  * @internal
  691.  */
  692. class KIO_EXPORT KBindingPropsPlugin : public KPropsDlgPlugin
  693. {
  694.   Q_OBJECT
  695. public:
  696.   /**
  697.    * Constructor
  698.    */
  699.   KBindingPropsPlugin( KPropertiesDialog *_props );
  700.   virtual ~KBindingPropsPlugin();
  701.  
  702.   virtual void applyChanges();
  703.   static bool supports( KFileItemList _items );
  704.  
  705. private:
  706.  
  707.   QLineEdit *commentEdit;
  708.   QLineEdit *patternEdit;
  709.   QLineEdit *mimeEdit;
  710.   QString m_sMimeStr;
  711.  
  712.   QCheckBox * cbAutoEmbed;
  713.  
  714.   class KBindingPropsPluginPrivate;
  715.   KBindingPropsPluginPrivate *d;
  716. };
  717.  
  718. /**
  719.  * Properties plugin for device .desktop files
  720.  * @internal
  721.  */
  722. class KIO_EXPORT KDevicePropsPlugin : public KPropsDlgPlugin
  723. {
  724.   Q_OBJECT
  725. public:
  726.   KDevicePropsPlugin( KPropertiesDialog *_props );
  727.   virtual ~KDevicePropsPlugin();
  728.  
  729.   virtual void applyChanges();
  730.  
  731.   static bool supports( KFileItemList _items );
  732.  
  733. private slots:
  734.   void slotActivated( int );
  735.   void slotDeviceChanged();
  736.   void slotFoundMountPoint( const unsigned long& kBSize,
  737.                             const unsigned long& /*kBUsed*/,
  738.                             const unsigned long& kBAvail,
  739.                             const QString& );
  740.  
  741. private:
  742.   void updateInfo();
  743.  
  744. private:
  745.   QComboBox* device;
  746.   QLabel* mountpoint;
  747.   QCheckBox* readonly;
  748.   void* unused;
  749.   //KIconButton* mounted;
  750.   KIconButton* unmounted;
  751.  
  752.   QStringList m_devicelist;
  753.   int indexDevice;
  754.   int indexMountPoint;
  755.   int indexFSType;
  756.  
  757.   QPixmap pixmap;
  758.   QString pixmapFile;
  759.  
  760.   class KDevicePropsPluginPrivate;
  761.   KDevicePropsPluginPrivate *d;
  762. };
  763.  
  764. class KPropertiesDesktopBase;
  765.  
  766. /**
  767.  * Used to edit the files containing
  768.  * [Desktop Entry]
  769.  * Type=Application
  770.  *
  771.  * Such files are used to represent a program in kicker and konqueror.
  772.  * @internal
  773.  */
  774. class KIO_EXPORT KDesktopPropsPlugin : public KPropsDlgPlugin
  775. {
  776.   Q_OBJECT
  777. public:
  778.   /**
  779.    * Constructor
  780.    */
  781.   KDesktopPropsPlugin( KPropertiesDialog *_props );
  782.   virtual ~KDesktopPropsPlugin();
  783.  
  784.   virtual void applyChanges();
  785.  
  786.   static bool supports( KFileItemList _items );
  787.  
  788. public slots:
  789.   void slotAddFiletype();
  790.   void slotDelFiletype();
  791.   void slotBrowseExec();
  792.   void slotAdvanced();
  793.   void slotSelectMimetype();
  794.  
  795. private:
  796.   void checkCommandChanged();
  797.  
  798. private:
  799.   KPropertiesDesktopBase* w;
  800.  
  801.   QString m_origCommandStr;
  802.   QString m_terminalOptionStr;
  803.   QString m_suidUserStr;
  804.   QString m_dcopServiceType;
  805.   bool m_terminalBool;
  806.   bool m_terminalCloseBool;
  807.   bool m_suidBool;
  808.   bool m_startupBool;
  809.   bool m_systrayBool;
  810.  
  811.   class KDesktopPropsPluginPrivate;
  812.   KDesktopPropsPluginPrivate *d;
  813. };
  814.  
  815. /**
  816.  * Used to edit the files containing
  817.  * [Desktop Entry]
  818.  * Type=Application
  819.  *
  820.  * Such files are used to represent a program in kicker and konqueror.
  821.  * @internal
  822.  * @deprecated replaced with KDesktopPropsPlugin
  823.  */
  824.  /// Remove in KDE4
  825. class KIO_EXPORT_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin
  826. {
  827.   Q_OBJECT
  828. public:
  829.   /**
  830.    * Constructor
  831.    */
  832.   KExecPropsPlugin( KPropertiesDialog *_props );
  833.   virtual ~KExecPropsPlugin();
  834.  
  835.   virtual void applyChanges();
  836.  
  837.   static bool supports( KFileItemList _items );
  838.  
  839. public slots:
  840.   void slotBrowseExec();
  841.  
  842. private slots:
  843.   void enableCheckedEdit();
  844.   void enableSuidEdit();
  845.  
  846. private:
  847.  
  848.     QLabel *terminalLabel;
  849.     QLabel *suidLabel;
  850.     KLineEdit *execEdit;
  851.     QCheckBox *terminalCheck;
  852.     QCheckBox *suidCheck;
  853.     KLineEdit *terminalEdit;
  854.     KLineEdit *suidEdit;
  855.     KLineEdit *swallowExecEdit;
  856.     KLineEdit *swallowTitleEdit;
  857.     QButton *execBrowse;
  858.  
  859.     QString execStr;
  860.     QString swallowExecStr;
  861.     QString swallowTitleStr;
  862.     QString termOptionsStr;
  863.     bool termBool;
  864.     bool suidBool;
  865.     QString suidUserStr;
  866.  
  867.     class KExecPropsPluginPrivate;
  868.     KExecPropsPluginPrivate *d;
  869. };
  870.  
  871. /**
  872.  * Used to edit the files containing
  873.  * [Desktop Entry]
  874.  * Type=Application
  875.  *
  876.  * Such files are used to represent a program in kicker and konqueror.
  877.  * @internal
  878.  * @deprecated replaced with KDesktopPropsPlugin
  879.  */
  880.  /// Remove in KDE4
  881. class KIO_EXPORT_DEPRECATED KApplicationPropsPlugin : public KPropsDlgPlugin
  882. {
  883.   Q_OBJECT
  884. public:
  885.   /**
  886.    * Constructor
  887.    */
  888.   KApplicationPropsPlugin( KPropertiesDialog *_props );
  889.   virtual ~KApplicationPropsPlugin();
  890.  
  891.   virtual void applyChanges();
  892.  
  893.   static bool supports( KFileItemList _items );
  894.  
  895. public slots:
  896.   void slotDelExtension();
  897.   void slotAddExtension();
  898.  
  899. private slots:
  900.   void updateButton();
  901.  
  902. private:
  903.   void addMimeType( const QString & name );
  904.  
  905.   QLineEdit *commentEdit;
  906.   QLineEdit *genNameEdit;
  907.   QLineEdit *nameEdit;
  908.   QListBox  *extensionsList;
  909.   QListBox  *availableExtensionsList;
  910.   QPushButton *addExtensionButton;
  911.   QPushButton *delExtensionButton;
  912.  
  913.   class KApplicationPropsPluginPrivate;
  914.   KApplicationPropsPluginPrivate *d;
  915. };
  916.  
  917. #endif
  918.  
  919.